package net.zjitc.controller.client;

import net.zjitc.pojo.Board;
import net.zjitc.pojo.Movie;
import net.zjitc.service.MovieService;
import net.zjitc.service.BoardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;

/**
 * @Author admin
 * @Date 2019/5/21 11:19
 */
@Controller
public class IndexController {
    @Autowired
    MovieService movieService;
    @Autowired
    BoardService boardService;

    @RequestMapping(value = "/index")
    public String user_login(Model model){
        List<Movie> byhot = movieService.index_hot();
        List<Movie> bydate = movieService.index_date();
        List<Movie> byold = movieService.index_old();
        model.addAttribute("old_list",byold);
        model.addAttribute("date_list",bydate);
        model.addAttribute("hot_list",byhot);

        List<Board> ticket = boardService.MovieByticket();
        model.addAttribute("ticket",ticket);
        List<Board> wish = boardService.MovieByWish();
        model.addAttribute("wish",wish);
        List<Board> score = boardService.MovieByScore();
        model.addAttribute("score",score);
        return "/client/index";
    }
}
